import axios from "@/utils/index"

// 添加配置
export const addConfig = params => {
    return axios.post("/config/create", params)
}

// 配置查询列表
export const configSearchList = params => {
    return axios.post("/config/search", params)
}

// 登录
export const login = params => {
    return axios.post("/user/login", params)
}

// 注册
export const registerApi = params => {
    return axios.post("/user/register", params)
}

export const userList = () => {
    return axios.get("/user/list")
}


// 获取项目列表
export const searchProject = params => {
    return axios.post("/project/search", params)
}

// 项目列表
export const projectList = () => {
    return axios.get("/project/list", )
}

// 添加项目
export const projectAdd = params => {
    return axios.post("/project/create", params)
}

// 项目详情
export const projectDetail = params => {
    return axios.get("/project/detail?id=" + params)
}

// 删除项目
export const projectDel = params => {
    return axios.post("/project/delete", params)
}

// 编辑项目
export const projectEdit = (params) => {
    return axios.post("/project/update", params)
}

// 模块列表
export const moduleList = params => {
    return axios.post("/product/list", params)
}

// 项目模块列表不分页
export const modules = params => {
    return axios.get("/product/products?id=" + params)
}

// 新增模块
export const moduleAdd = params => {
    return axios.post("/product/create", params)
}

// 模块编辑
export const moduleUpdate = params => {
    return axios.post("/product/update", params)
}

// 模块删除
export const moduleDel = params => {
    return axios.post("/product/remove", params)
}


// 环境列表
export const envList = params => {
    return axios.post("/enviroment/search", params)
}

// 环境列表不带分页
export const envs = params => {
    return axios.get("/envs", {params: params})
}

// 添加环境
export const envAdd = params => {
    return axios.post("/enviroment/add", params)
}

// 删除环境
export const envDel = params => {
    return axios.post("/enviroment/remove", params)
}


// 环境详情
export const envDetail = params => {
    return axios.get("/enviroment/detail?id=" + params)
}

// 编辑环境
export const envEdit = params => {
    return axios.post("/enviroment/update", params)
}

// 添加数据库管理
export const AddDataBase = params => {
    return axios.post("/add_database", params)
}

// 数据库列表
export const DataBaseList = params => {
    return axios.get("/database_list", {params: params})
}

// 删除数据库
export const DataBaseDel = params => {
    return axios.delete("/database_del/" + params)
}

// 获取数据库详情
export const DataBaseDetail = params => {
    return axios.get("database_detail", {params: params})
}

// 编辑数据库
export const DataBaseEdit = params => {
    return axios.post("/database_edit", params)
}

// 获取接口
export const apiSearchList = params => {
    return axios.post("/interface/search", params)
}


// 添加接口
export const apiAdd = params => {
    return axios.post("/interface/create", params)
}

// 获取接口详情
export const apiDetail = params => {
    return axios.get("/interface/detail?id=" + params)
}

// 编辑接口
export const apiEdit = params => {
    return axios.post("/interface/update", params)
}

// 删除接口
export const delApi = params => {
    return axios.post("/interface/remove", params)
}

// 获取当前项目下的所有接口基本信息
export const apiAll = params => {
    return axios.get("/inter_all", {params: params})
}

// 添加测试用例
export const addCase = params => {
    return axios.post("/add_case", params)
}

// 查询接口用例列表
export const caseList = params => {
    return axios.get("/case_list", {params: params})
}

// 获取用例详情
export const caseDetail = params => {
    return axios.get("/case_detail", {params: params})
}

// 修改接口
export const caseEdit = params => {
    return axios.post("/case_edit", params)
}

// 用例执行
export const caseDebug = params => {
    return axios.get("/case_debug", {params: params})
}

// 用例导出
export const caseExport = params => {
    return axios.get("/case_export", {params: params, responseType: "arraybuffer"})
}

// 下载模板
export const caseDownTemplate = () => {
    return axios.get("/case_down_template", {responseType: "arraybuffer"})
}

// 用例报告
export const caseResultApi = params => {
    return axios.get("/case_result", {params: params})
}

// 用例报告日志
export const caseLog = params => {
    return axios.get("/case_log", {params: params})
}
